package wt.hpad.utils;

import android.util.Log;


/**
 * Created by wt on 2017-7-27.
 */
public class LogUtil {
    private static String myLog = "-{";

    /**
     * 日志输出级别NONE
     */
    public static final int LEVEL_OFF = 0;
    /**
     * 日志输出级别NONE
     */
    public static final int LEVEL_ALL = 7;

    /**
     * 日志输出级别V
     */
    public static final int LEVEL_VERBOSE = 1;
    /**
     * 日志输出级别D
     */
    public static final int LEVEL_DEBUG = 2;
    /**
     * 日志输出级别I
     */
    public static final int LEVEL_INFO = 3;
    /**
     * 日志输出级别W
     */
    public static final int LEVEL_WARN = 4;
    /**
     * 日志输出级别E
     */
    public static final int LEVEL_ERROR = 5;
    /**
     * 日志输出级别S,自定义定义的一个级别
     */
    public static final int LEVEL_SYSTEM = 6;

    /**
     * 是否允许输出log
     */
    private static int mDebuggable = AppUtil.DEBUGLEVEL;

    public static void logI(String TAG, String fName, String content) {
        if (mDebuggable >= LEVEL_INFO) {
            Log.i(myLog + TAG + "}", "" + fName + content);
        }
    }

    public static void logI_Thread(String TAG, String fName, String content) {
        if (mDebuggable >= LEVEL_INFO) {
            Log.i(myLog + TAG + "}", "" + fName + content + "          [" + Thread.currentThread().getName() + "]");
        }
    }

    public static void logI_Time(String TAG, String fName, String content) {
        if (mDebuggable >= LEVEL_INFO) {
            Log.i(myLog + TAG + "}", "" + fName + content + "          [" + TimeUtil.getTimeHMS() + "]");
        }
    }

    public static void logI_Thread_Time(String TAG, String fName, String content) {
        if (mDebuggable >= LEVEL_INFO) {
            Log.i(myLog + TAG + "}", "" + fName + content + "          [" + Thread.currentThread().getName() + "..." + TimeUtil.getTimeHMS() + "]");
        }
    }

    public static void logILine(String TAG, String fName) {
        if (mDebuggable >= LEVEL_INFO) {
            Log.i(myLog + TAG + "}", "" + fName + "===============================================================================================");
        }
    }
}
